wayland: Keep the drag window alive longer
authorMatthias Clasen <mclasen@redhat.com>
Fri, 8 Jan 2016 16:22:47 +0000 (11:22 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 8 Jan 2016 16:22:47 +0000 (11:22 -0500)
We destroy the widget that is wrapped around the drag window
when the object data on the drag context gets cleared. Destroying
the window before that happens leads to unpleasantries. E.g. we may
try to access the frame clock, which doesn't exist anymore, and
things go downhill from there. So, keep the window alive for
a little longer.

gdk/wayland/gdkdnd-wayland.c

index 36259e933a22dada7a0bb2bc2fab75002151d125..8eb8688e0d27a88a09fcf17e66294bc82529c11b 100644 (file)
@@ -68,6 +68,7 @@ gdk_wayland_drag_context_finalize (GObject *object)
 {
   GdkWaylandDragContext *wayland_context = GDK_WAYLAND_DRAG_CONTEXT (object);
   GdkDragContext *context = GDK_DRAG_CONTEXT (object);
+  GdkWindow *dnd_window;
 
   contexts = g_list_remove (contexts, context);
 
@@ -86,10 +87,12 @@ gdk_wayland_drag_context_finalize (GObject *object)
   if (wayland_context->data_source)
     wl_data_source_destroy (wayland_context->data_source);
 
-  if (wayland_context->dnd_window)
-    gdk_window_destroy (wayland_context->dnd_window);
+  dnd_window = wayland_context->dnd_window;
 
   G_OBJECT_CLASS (gdk_wayland_drag_context_parent_class)->finalize (object);
+
+  if (dnd_window)
+    gdk_window_destroy (dnd_window);
 }
 
 void